Skip to contentSkip to conversation

Change in openvpn[master]: push: Improve check of vsnprintf return value

Openvpn-devel Superseded flichtenheld (Code Review) 2 participants 6 messages Jan 30 – Mar 5 1 message not in the archive

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1769789455000.I7be033bc88e9a6ba474916c8be039c126e8bc574@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1502?usp=email

to review the following change.

Change subject: push: Improve check of vsnprintf return value
......................................................................

push: Improve check of vsnprintf return value

Avoid sign-compare warning and do not ignore error return values.

Change-Id I7be033bc88e9a6ba474916c8be039c126e8bc574

---
M src/openvpn/push.c

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1502/1

src/openvpn/push.c +1 -10
index d13b24a..a948973 100644
@@ -800,11 +800,6 @@
     gc_free(&gc);
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 bool
 send_push_reply(struct context *c, struct push_list *per_client_push_list)
 {
@@ -936,7 +931,7 @@
     va_start(arglist, format);
     len = vsnprintf(tmp, sizeof(tmp), format, arglist);
     va_end(arglist);
-    if (len > sizeof(tmp) - 1)
+    if (len < 0 || len >= (int)sizeof(tmp))
     {
         return false;
     }
@@ -944,10 +939,6 @@
     return true;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 void
 push_reset(struct options *o)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1502?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7be033bc88e9a6ba474916c8be039c126e8bc574
Gerrit-Change-Number: 1502
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

plaisthos has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1502?usp=email )

Change subject: push: Improve check of vsnprintf return value
......................................................................

Patch Set 5: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1502?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7be033bc88e9a6ba474916c8be039c126e8bc574
Gerrit-Change-Number: 1502
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 15:36:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH v5 1/1 push: Improve check of vsnprintf return value

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Avoid sign-compare warning and do not ignore error return values.

Change-Id I7be033bc88e9a6ba474916c8be039c126e8bc574

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1502
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1502
This mail reflects revision 5 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

src/openvpn/push.c +1 -10
index d13b24a..a948973 100644
@@ -800,11 +800,6 @@
     gc_free(&gc);
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 bool
 send_push_reply(struct context *c, struct push_list *per_client_push_list)
 {
@@ -936,7 +931,7 @@
     va_start(arglist, format);
     len = vsnprintf(tmp, sizeof(tmp), format, arglist);
     va_end(arglist);
-    if (len > sizeof(tmp) - 1)
+    if (len < 0 || len >= (int)sizeof(tmp))
     {
         return false;
     }
@@ -944,10 +939,6 @@
     return true;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 void
 push_reset(struct options *o)
 {
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: push: Improve check of vsnprintf return value

Again, straight forward enough, and BB confirms "all green".

Your patch has been applied to the master branch.

commit 4523e506bd2978c78a29824ce471c0518e85cb6c

Author: Frank Lichtenheld
Date:   Wed Mar 4 17:48:58 2026 +0100
     push: Improve check of vsnprintf return value

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1502
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg35905.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#6) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1502?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

Change subject: push: Improve check of vsnprintf return value
......................................................................

push: Improve check of vsnprintf return value

Avoid sign-compare warning and do not ignore error return values.

Change-Id I7be033bc88e9a6ba474916c8be039c126e8bc574

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1502
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35905.html

---
M src/openvpn/push.c

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1502/6

src/openvpn/push.c +1 -10
index 8541467..93c5558 100644
@@ -800,11 +800,6 @@
     gc_free(&gc);
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 bool
 send_push_reply(struct context *c, struct push_list *per_client_push_list)
 {
@@ -936,7 +931,7 @@
     va_start(arglist, format);
     len = vsnprintf(tmp, sizeof(tmp), format, arglist);
     va_end(arglist);
-    if (len > sizeof(tmp) - 1)
+    if (len < 0 || len >= (int)sizeof(tmp))
     {
         return false;
     }
@@ -944,10 +939,6 @@
     return true;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 void
 push_reset(struct options *o)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1502?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7be033bc88e9a6ba474916c8be039c126e8bc574
Gerrit-Change-Number: 1502
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1502?usp=email )

Change subject: push: Improve check of vsnprintf return value
......................................................................

push: Improve check of vsnprintf return value

Avoid sign-compare warning and do not ignore error return values.

Change-Id I7be033bc88e9a6ba474916c8be039c126e8bc574

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1502
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35905.html

---
M src/openvpn/push.c

1 file changed, 1 insertion(+), 10 deletions(-)
src/openvpn/push.c +1 -10
index 8541467..93c5558 100644
@@ -800,11 +800,6 @@
     gc_free(&gc);
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 bool
 send_push_reply(struct context *c, struct push_list *per_client_push_list)
 {
@@ -936,7 +931,7 @@
     va_start(arglist, format);
     len = vsnprintf(tmp, sizeof(tmp), format, arglist);
     va_end(arglist);
-    if (len > sizeof(tmp) - 1)
+    if (len < 0 || len >= (int)sizeof(tmp))
     {
         return false;
     }
@@ -944,10 +939,6 @@
     return true;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 void
 push_reset(struct options *o)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1502?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7be033bc88e9a6ba474916c8be039c126e8bc574
Gerrit-Change-Number: 1502
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>